import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Markdown from 'vite-plugin-md'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import path from 'path'

export default defineConfig({
  resolve: {
    alias: {
      '@': '/src',
      '@page': '/src/views/page',
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `
          @import "./src/assets/style/reset.scss";
          @import "./src/assets/style/global.scss";
          @import "./src/assets/style/markdown.scss";
        `,
      },
    },
  },
  plugins: [
    vue({
      include: [/\.vue$/, /\.md$/],
    }),
    Markdown(),
    createSvgIconsPlugin({
      // 指定需要缓存的图标文件夹
      iconDirs: [ path.resolve(process.cwd(), 'src/assets/icon') ],
      // 指定symbolId格式
      symbolId: '[name]',
      customDomId: '__svg__icons__dom__',
    }),
  ],

})
